package com.iqiyi.pps.epg.core.model.sginal;

import com.iqiyi.pps.epg.api.model.web.sginal.TVersionController;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by yanchao_sx on 2018/1/5.
 */
@Entity
@Table(name = "version_controller")
@Cache(usage = CacheConcurrencyStrategy.NONE)
public class VersionController {

    public static final int VERSION_NUM = 5;
    public static final int ZZD_VERSION_IND = 3;
    public static final int ENCODER_VERSION_IND = 4;
    public static final int MERGE_TOOL_VERSION_IND = 5;
    public static final int MERGE_SERVICE_VERSION_IND = 6;
    public static final int PRECISION_CUT_TOOL_VERSION_IND = 7;
    public static final int HARDWARE_IND = 0;
    public static final int SERVERSTATUS_IND = 2;
    public static final int VERSIONSTATUS_IND = 1;

    public static final String ZZD_VERSION = "version.zzdVersion";
    public static final String ENCODER_VERSION = "version.encoderVersion";
    public static final String MERGE_TOOL_VERSION = "version.mergeToolVersion";
    public static final String MERGE_SERVICE_VERSION = "version.mergeServiceVersion";
    public static final String PRECISION_CUT_TOOL_VERSION = "version.precisionCutToolVersion";
    public static final String HARDWARE = "server.hardware";
    public static final String SERVERSTATUS = "server.status";
    public static final String VERSIONSTATUS = "version.serverStatus";

    public static final int SERVICE_NORMAL = 2;
    public static final int SERVICE_ACCESS_ABNORMAL = 0;
    public static final int SERVICE_API_ABNORMAL = 1;
    public static final int DIFFERENT_VERSION = 3;

    public static final int ZZD_TYPE = 9;
    public static final String CHANNEL_CONFIG_TYPE = "zzd_main_version";

    private int id;
    private int serverId;
    private String insideServerIp;
    private String zzdVersion;
    private String encoderVersion;
    private String mergeToolVersion;
    private String mergeServiceVersion;
    private String precisionCutToolVersion;
    private int serverStatus; //�汾״̬
    private Timestamp updateTime;
    private String outsideIp;
    private String hardware;
    private String remark;
    private int status; //������״̬



    public VersionController(int serverId, int serverStatus){
        this.serverId = serverId;
        this.serverStatus = serverStatus;
    }

    public VersionController(){

    }

    public TVersionController convertThriftModel() {
        TVersionController tVersionController = new TVersionController();
        tVersionController.setId(this.id);
        tVersionController.setServerId(this.serverId);
        tVersionController.setZzdVersion(this.zzdVersion);
        tVersionController.setEncoderVersion(this.encoderVersion);
        tVersionController.setMergeServiceVersion(this.mergeServiceVersion);
        tVersionController.setMergeToolVersion(this.mergeToolVersion);
        tVersionController.setPrecisionCutToolVersion(this.precisionCutToolVersion);
        tVersionController.setUpdateTime(this.updateTime.toString());
        tVersionController.setInsideServerIp(this.insideServerIp);
        tVersionController.setServerStatus(this.serverStatus);
        tVersionController.setOutsideIp(this.outsideIp);
        tVersionController.setHardware(this.hardware);
        tVersionController.setRemark(this.remark);
        tVersionController.setStatus(this.status);
        return tVersionController;
    }


    @Transient
    public String getHardware() {
        return hardware;
    }

    public void setHardware(String hardware) {
        this.hardware = hardware;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name="server_id")
    public int getServerId() {
        return serverId;
    }

    public void setServerId(int serverId) {
        this.serverId = serverId;
    }

    @Column(name="zzd_version")
    public String getZzdVersion() {
        return zzdVersion;
    }

    public void setZzdVersion(String zzdVersion) {
        this.zzdVersion = zzdVersion;
    }

    @Column(name="encoder_version")
    public String getEncoderVersion() {
        return encoderVersion;
    }

    public void setEncoderVersion(String encoderVersion) {
        this.encoderVersion = encoderVersion;
    }

    @Column(name="merge_tool_version")
    public String getMergeToolVersion() {
        return mergeToolVersion;
    }

    public void setMergeToolVersion(String mergeToolVersion) {
        this.mergeToolVersion = mergeToolVersion;
    }

    @Column(name="merge_service_version")
    public String getMergeServiceVersion() {
        return mergeServiceVersion;
    }

    public void setMergeServiceVersion(String mergeServiceVersion) {
        this.mergeServiceVersion = mergeServiceVersion;
    }

    @Column(name="precision_cut_tool_version")
    public String getPrecisionCutToolVersion() {
        return precisionCutToolVersion;
    }

    public void setPrecisionCutToolVersion(String precisionCutToolVersion) {
        this.precisionCutToolVersion = precisionCutToolVersion;
    }

    @Column(name="server_status")
    public int getServerStatus() {
        return serverStatus;
    }

    public void setServerStatus(int serverStatus) {
        this.serverStatus = serverStatus;
    }

    @Column(name="update_time")
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Transient
    public String getInsideServerIp() {
        return insideServerIp;
    }

    public void setInsideServerIp(String insideServerIp) {
        this.insideServerIp = insideServerIp;
    }

    @Transient
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Transient
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    @Transient
    public String getOutsideIp() {
        return outsideIp;
    }

    public void setOutsideIp(String outsideIp) {
        this.outsideIp = outsideIp;
    }
}
